<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Style-Type" content="text/css">
<!-- meta -->
<meta name="keywords" content="">
<meta name="description" content="">
<!-- /meta -->
<title>カスタムスキーマ作成</title>
<!-- JQuery 用 -->
<link href="<%= request.getContextPath() %>/common/css/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="<%= request.getContextPath() %>/common/js/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="<%= request.getContextPath() %>/common/js/jquery-ui-1.8.9.custom.min.js" type="text/javascript"></script>
<script src="<%= request.getContextPath() %>/common/js/jquery.cookie.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/base.css">
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/headerfooter.css">
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/ulol.css">
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/arrow.css">
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/elements.css">
<!-- admin -->
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/base_admin.css">
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/elements_admin.css">
<!-- /admin -->
<script type="text/javascript" src="<%= request.getContextPath() %>/common/js/library.js"></script>
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/for_winie3.css">
<!--[if gte IE 5]>
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/for_over_winie5.css">
<![endif]-->
<!--[if IE 5]>
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/for_winie5.css">
<![endif]-->

<script type='text/javascript' src='<%= request.getContextPath() %>/dwr/interface/dchDWR.js'></script>
<script type='text/javascript' src='<%= request.getContextPath() %>/dwr/engine.js'></script>
<script type='text/javascript' src='<%= request.getContextPath() %>/dwr/util.js'></script>

<SCRIPT type="text/javascript">

<s:if test=' successSign != null '>
	<s:if test=' successSign == "2" '>
		if (!window.opener) {
			alert("親Windowがないです。");
			window.close();
		} else {
			<s:if test=' addEditSign == "0" '>
				window.opener.addCustomSchema('<s:property value="itemName" escape="false" escapeJavaScript="true"/>','<s:property value="inputType" escape="false" escapeJavaScript="true"/>', '<s:property value="optionKbn" escape="false"/>','<s:property value="optionResult" escape="false"/>');
			</s:if>
			<s:if test=' addEditSign == "1" '>
				window.opener.editCustomSchema('<s:property value="editIndex" escape="false" escapeJavaScript="true"/>','<s:property value="itemName" escape="false" escapeJavaScript="true"/>','<s:property value="inputType" escape="false" escapeJavaScript="true"/>', '<s:property value="optionKbn" escape="false" escapeJavaScript="true"/>','<s:property value="optionResult" escape="false" escapeJavaScript="true"/>');
			</s:if>
			window.close();
		}
	</s:if>
</s:if>


	function createItem() {

		frm.action ='<%= request.getContextPath() %>/outputschema/popupCustomSchema-make';
		frm.submit();

	}

	function editInputType(editIndex, type, optionKbn, optionResult) {

		//document.getElementById("editIndexId").value = editIndex;
		document.getElementById("typeId").value = type;
		document.getElementById("optionKbnId").value = optionKbn;
		document.getElementById("optionResultId").value = optionResult;
		frm.action ='<%= request.getContextPath() %>/outputschema/popupCustomSchema-setInputType';
		frm.submit();
	}

	function popUpCreateInputItem(inputType, optionKbn, options){
		 var url = '<%= request.getContextPath() %>/outputschema/popupCreateInputItem';
		 $('#createInputInputType').val(inputType);
		 $('#createInputOptionKbn').val(optionKbn);
		 $('#createInputOptionResult').val(options);

		 openByPost( url, $('#createInput').clone(), "createInput" );

	}

	function clearInputType() {
		document.getElementById("type1").innerHTML = "";
		document.getElementById("inputTypeId").value = "";
		document.getElementById("optionKbnId").value = "";
		document.getElementById("optionResultId").value = "";
	}

	//window.openByPost 実装



</SCRIPT>
</head>
<body id="dch" >
<div id = "createInput" style="display:none" >
	<input type="hidden" name="type" id = "createInputInputType" />
	<input type="hidden" name="optionKbn" id = "createInputOptionKbn"/>
	<input type="hidden" name="optionResult" id = "createInputOptionResult"/>
</div>
<!-- === headerArea === -->
<div id="headerArea">
<a name="pageTop" id="pageTop"></a>
</div><!-- === /headerArea === -->
<!-- === mainArea === -->
<div id="mainArea">
<form name="frm" >

<s:hidden name="editIndex" id = "editIndexId"/>
<s:hidden name="addEditSign" id = "addEditSignId"/>

<s:hidden name="setType" id = "typeId"/>
<s:hidden name="setOptionKbn" id = "optionKbnId"/>
<s:hidden name="setOptionResult" id = "optionResultId"/>

<table border="0" cellspacing="0" cellpadding="0" width="100%">
	<tr valign="top">
		<td width="20"><img src="<%= request.getContextPath() %>/common/images/spacer.gif" width="20" height="4" border="0" alt=""></td>
		<td id="contentsArea">
		<!-- === contentsArea === -->
			<!-- headingLv01Block -->
			<div class="headingLv01Block">
				<!-- headingLv01 -->
				<h1>カスタムスキーマ作成</h1>
				<!-- /headingLv01 -->
				<!-- lead -->
				<div class="lead">

			</div>
			<div class="columnB01">
			 <s:fielderror/>
			 <s:actionerror/>
			 <s:actionmessage/>
			</div>
				<!-- /lead -->
			</div>
			<!-- /headingLv01Block -->
			<!-- columnB01 -->
			<div class="columnB01">
				<p class="text">カスタムスキーマの作成・設定を行います</p>
				<span id="fieldErr"></span>
			</div>
			<!-- /columnB01 -->

			<div class="tableBlock">
				<!-- tableA01 -->
				<div class="tableA01">
				<table border="1" cellspacing="0" cellpadding="5" width="558">
					<tr>
						<!-- ラベル --><th class="lv01B" width="170" colspan="2"><label for="itemName">項目名</label></th>
						<!-- エラー --><th width="11" class="error">&nbsp;</th>
						<!-- 内容 --><td>
							<s:textfield name = "itemName" size="35" />
						</td>
					</tr>
					<tr>
						<!-- ラベル --><th class="lv01B" width="170" ><label for="fServiceCode">入力形式</label><br>
						<input type="button" value="作成" onclick="popUpCreateInputItem('${inputType}','${optionKbn}','<s:property value="optionResult" escape="false" escapeJavaScript="true"/>')"> <input type="button" value="クリア" onclick="clearInputType()"></th>
						<!-- ラベル --><th class="lv01B" width="170"><label for="fServiceCode">形式</label></th>
						<!-- エラー --><th width="11" class="error">&nbsp;</th>
						<!-- 内容 --><td>
										<c:if test="${inputType == '0'}" >
											<span id="type1">テキスト</span>
							 				<s:hidden name="inputType" id = "inputTypeId" />
										</c:if>
										<c:if test="${inputType == '1'}" >
											<span id="type1">テキストエリア</span>
									 		<s:hidden name="inputType" id = "inputTypeId"/>
										</c:if>
										<c:if test="${inputType == '2'}" >
											<span id="type1">ドロップダウンリスト</span>
									 		<s:hidden name="inputType" id = "inputTypeId"/>
										</c:if>
										<c:if test="${inputType == '3'}" >
											<span id="type1">ラジオボタン</span>
									 		<s:hidden name="inputType" id = "inputTypeId"/>
										</c:if>
										<c:if test="${inputType == '4'}" >
											<span id="type1">チェックボックス</span>
									 		<s:hidden name="inputType" id = "inputTypeId"/>
										</c:if>
										<c:if test="${inputType == '5'}" >
											<span id="type1">日付</span>
									 		<s:hidden name="inputType" id = "inputTypeId"/>
										</c:if>
										<c:if test="${inputType == '6'}" >
											<span id="type1">複数テキスト</span>
									 		<s:hidden name="inputType" id = "inputTypeId"/>
										</c:if>
										<c:if test="${inputType == '7'}" >
											<span id="type1">フィールド指定</span>
									 		<s:hidden name="inputType" id = "inputTypeId"/>
										</c:if>
										<c:if test="${inputType == '' || inputType == null}" >
											<span id="type1">テキスト</span>
									 		<s:hidden name="inputType" value="0" id = "inputTypeId"/>
										</c:if>

										<s:hidden name="optionKbn" id = "optionKbnId"/>
							 			<s:hidden name="optionResult" id = "optionResultId"/>
									</td>
					</tr>
				</table>
				</div>
				<!-- /tableA01 -->
			</div>
			<!-- pageNaviC01 -->
			<div class="pageNaviC01">
			<table border="0" cellspacing="0" cellpadding="10" width="558">
				<tr>
					<td width="298" class="left"><p><input type="button" value="キャンセル" style="width:100px" onclick="window.close();"></p></td>
					<td width="130" class="left">&nbsp;</td>
					<td width="130" class="right"><p><input type="button" value="作成する" style="width:130px" onclick="createItem()"></p></td>
				</tr>
			</table>
			</div>
			<!-- /pageNaviC01 -->
			<!-- === /contentsArea === -->
		</td>
		<td width="16"><img src="<%= request.getContextPath() %>/common/images/spacer.gif" width="16" height="4" border="0" alt=""></td>
	</tr>
</table>
</form>
</div><!-- === /mainArea === -->
<!-- === footerArea === -->
<div id="footerArea">
<!--#include virtual="<%= request.getContextPath() %>/common/include/footer.html" -->
</div><!-- === /footerArea === -->
</body>
</html>
<!-- System Architect is COOBA Corp
	Copyright 2010 COOBA Corp All rights reserved -->